home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
UTILITIE
/
FIXCH302.ZIP
/
FIXCHARS.DOC
< prev
next >
Wrap
Text File
|
1993-02-01
|
5KB
|
101 lines
FIXCHARS.DOC
02/01/93
Introduction:
This program reads in any text file (with out without carriage return/line
feeds) and replaces all non-printable characters (except the CR/LF stuff) with
spaces. Non-printable characters are any characters defined as being below
decimal 32 (except for the CR and LF characters which are 10 and 13
respectively) and any characters above decimal 126.
The program can operate in two modes. The first mode is a BINARY mode which
reads in the file character by character and processes it slowly like this.
BINARY mode is wonderful for files that don't actually have separate lines;
everything's been blocked together and you haven't run something like SPLITREC
on it yet.
The second mode is TEXT mode. This reads the file in a line at a time and
processes the entire line. This mode is quicker and it is the default for this
routine. TEXT mode automatically handles tab expansion and it removes backspace
characters. But you can't use this if your file isn't already there as separate
lines of ASCII text. (Don't try to handle a native WordPerfect file, for
example, using this mode.)
Running the program:
The programs requires two parameters to be provided in the order specified
below. It also accepts other optional parameters which can be specified in any
order:
FIXCHARS infile { outfile [ /OVERWRITE | /-OVERWRITE | /OVERASK ] |
/REPLACE } [ /BINARY | /TEXT ] [ /Ffilename ] [ /-EJECT ] [ /Q ] [ /? ]
"infile" is the name of the input file to check. It can include a drive and
path specification.
"outfile" is the name of the file to create. It can include a drive and path
specification. You have to specify either an outfile or the /REPLACE option.
"/OVERWRITE" says to overwrite the output file if it exists already.
"/-OVERWRITE" says to abort if the output file exists already.
"/OVERASK" says to prompt if the output file exists already; this is the
default.
"/REPLACE" says to write the results to a temporary file and, if the program
finds characters to change and runs successfully, to replace the original file
with the fixed temporary file. The original file is renamed with a BAK
extension if you use this option. You have to specify *either* an output file
name or the /REPLACE option.
"/BINARY" is used if the input file has not been separated into records yet.
The file is read a character at a time. In BINARY mode, trailing spaces are not
removed on the lines. BINARY is the safest bet. BINARY is rather slow,
processing text at the rate of about 1,200 cps. A 572K file takes a bit under
eight minutes to handle.
"/TEXT" is used if the input file consists of normal text records. Trailing
spaces are removed at the end of each record. /TEXT mode also handles tab
expansion and removes backspace characters from the file. /TEXT is the default
mode. Execution is very quick: a 48 megabyte file can be processed in just 14
minutes (55,000 cps!).
"/Ffilename" specifies the file name to write out the results of this program
too. By default, a file is created called FIXCHARS.BAD which shows the date,
time, and file name being processed as well as all lines that had problems. The
file is appended to each time so it contains a running log of what you've run.
You can change this file name to something else (and provide drive and path
information if desired) or you can say /FNUL: and avoid creating the file
altogether.
"/-EJECT" says to translate page eject characters (decimal 12) into spaces. By
default, page eject characters are left in the document.
"/Q" turns off the line-by-line status messages.
"/?" or "/HELP" or "HELP" gives you syntactical help.
The file also keeps a log with the bad characters. By default, this file is
called FIXCHARS.BAD and it is created in your default directory. (You can
override the file name specification with the /Ffilename parameter. You can
also turn it off entirely using the /FNUL: specification.) If the file already
exists, the log will be appended instead of replaced. In BINARY mode, the
program writes out the individual characters it didn't like. In TEXT mode, the
program writes out the entire bad line.
Press Esc to quit the program early.
Program written by Bruce Guthrie. Comments and suggestions can be sent to:
Bruce Guthrie
Wayne Software
113 Sheffield St.
Silver Spring, MD 20910